﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Diploma.DAL.Hibernate.Abstract;
using Diploma.DAL.Hibernate.Concrete;

namespace Test.Diploma.UI.Web.MVC.Code.WindsorInstallers
{
    public class SessionFactoryInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            string configFileName = HttpContext.Current.Server.MapPath("~/hibernate.cfg.xml");
            container.Register(Component.For<ITestSessionFactory>().ImplementedBy<TestSessionFactory>().DependsOn(new { configFileName = configFileName }).LifeStyle.Singleton);
        }
    }
}